/* -*-c++-*- */
/* osgGIS - GIS Library for OpenSceneGraph
 * Copyright 2007-2008 Glenn Waldron and Pelican Ventures, Inc.
 * http://osggis.org
 *
 * osgGIS is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

#ifndef _OSGGIS_SPATIAL_INDEX_H_
#define _OSGGIS_SPATIAL_INDEX_H_ 1

#include <osgGIS/Common>
#include <osgGIS/Feature>
#include <osgGIS/FeatureCursor>
#include <osgGIS/GeoExtent>

namespace osgGIS
{
    /**
     * A interface for performing fast spatial queries against a FeatureStore.
     */
	class OSGGIS_EXPORT SpatialIndex : public osg::Referenced
	{
	public:

        /**
         * Queries the index for features that intersect a spatial extent.
         *
         * @extent
         *    Spatial extent within which to query.
         *
         * @match_exactly
         *    If true, the cursor will return only features whose shape data intersects
         *    the given extent. If false, the cursor will return features whose bounding-
         *    box extents intersect the search extent.
         *
         * @return
         *    A cursor that can iterate over the search results.
         */
	    virtual FeatureCursor getCursor( const GeoExtent& extent, bool match_exactly =false ) =0;
	    
        /**
         * Gets the full extents of the data indexed by this data structure.
         */
	    virtual const GeoExtent& getExtent() const =0;
	};
}

#endif //_OSGGIS_SPATIAL_INDEX_H_

